package com.qhgrain.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qhgrain.demo.service.RestTemplateDemoService;
import com.qhgrain.util.ServiceUrl;

@Controller
@RequestMapping("/demo")
public class DemoController {	
	
	@Autowired
	private RestTemplateDemoService restService;
	
	@RequestMapping(value="/user/{name}",method=RequestMethod.GET)
	@ResponseBody
	public String getUser(@PathVariable String name){
		String url=ServiceUrl.DEMOSERVICE+"hello/sayhello/"+name;
		return restService.getForObject(url);
	}

}
